package com.joinway.framework.support.audit.provider;

import java.util.List;

import org.apache.commons.collections4.CollectionUtils;
import org.aspectj.lang.ProceedingJoinPoint;

public class ClassAllMethodProvider implements IMonitoredMethodProvider {

	/**
	 * full name with package name
	 */
	protected List<String> classNames;
	
	public ClassAllMethodProvider(List<String> classNames){
		this.classNames = classNames;
	}
	
	@Override
	public boolean isTarget(ProceedingJoinPoint point) {
		String className = point.getTarget().getClass().getCanonicalName();
		
		return CollectionUtils.isNotEmpty(classNames) && classNames.stream().anyMatch(n -> n.equals(className));
	}

}
